package com.hjwoo.app.ui;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.TextView;

import com.hjwoo.app.R;

public class TimeDialog extends Dialog
{
    private Button mOK;
    private String contentStr;

    public TimeDialog(Context context, String contentStr)
    {
        super(context);
        this.contentStr = contentStr;
    }

    public TimeDialog(Context context, int theme, String contentStr)
    {
        super(context, theme);
        this.contentStr = contentStr;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.alertdialog_time);
        Window win = getWindow();
        win.setGravity(Gravity.CENTER);
        WindowManager.LayoutParams lp = win.getAttributes();
        lp.width = WindowManager.LayoutParams.MATCH_PARENT;
        win.setAttributes(lp);
        TextView content = (TextView) this.findViewById(R.id.alertdialog_center_content);
        content.setText(contentStr);
        mOK = (Button) this.findViewById(R.id.alertdialog_ok);
        mOK.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
    }

}
